package com.zhy.sample_circlemenu;

import com.zhy.sample_circlemenu.utils.ToastUtil;
import com.zhy.view.CircleMenuLayout;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Component;


/**
 * CCBAbility
 *
 * @author hw
 * @since 2021/6/30
 */
public class CCBAbility
        extends AbilitySlice  {
    private CircleMenuLayout mCircleMenuLayout;

    private String[] mItemTexts = new String[] { "安全中心 ", "特色服务", "投资理财",
            "转账汇款", "我的账户", "信用卡" };
    private int[] mItemImgs = new int[] { ResourceTable.Media_home_mbank_1_normal,
            ResourceTable.Media_home_mbank_2_normal, ResourceTable.Media_home_mbank_3_normal,
            ResourceTable.Media_home_mbank_4_normal, ResourceTable.Media_home_mbank_5_normal,
            ResourceTable.Media_home_mbank_6_normal };
    @Override
    protected void onStart(Intent intent) {
        getWindow().setStatusBarColor(getColor(ResourceTable.Color_title_background));
        super.onStart(intent);
        setUIContent(ResourceTable.Layout_ability_ccb_layout);
        mCircleMenuLayout = (CircleMenuLayout) findComponentById(ResourceTable.Id_id_menulayout);
        mCircleMenuLayout.setMenuItemIconsAndTexts(mItemImgs, mItemTexts);
        mCircleMenuLayout.setOnMenuItemClickListener(new CircleMenuLayout.OnMenuItemClickListener() {
            @Override
            public void itemClick(Component view, int pos) {
                ToastUtil.toast(CCBAbility.this,mItemTexts[pos]);

            }

            @Override
            public void itemCenterClick(Component view) {
                ToastUtil.toast(CCBAbility.this,"you can do something just like ccb");
            }
        });

    }

}
